﻿#include "GUI.h"
#include "DIALOG.h"
#include "CreateWidget.h"
#include "AppFunction.h"
#include "common_path.h"


 PARA_TCB curtain_widget[7];


void curtain_widget_create(WM_HWIN hParent){

	curtain_widget[0].guiTCB.winType = WIDGET_WINDOW;
	curtain_widget[0].guiTCB.xPos = 0;
	curtain_widget[0].guiTCB.yPos = 0;
	curtain_widget[0].guiTCB.xSize = 720;
	curtain_widget[0].guiTCB.ySize = 720;
	curtain_widget[0].appTCB.funType = GROUP_CONTROL;
	curtain_widget[0].guiTCB.pRedraw = draw_line;
	curtain_widget[0].appTCB.addrList = 0;
	curtain_widget[0].guiTCB.id = GetUniqueID();
	curtain_widget[0].pPreviousLayer = NULL;
	curtain_widget[0].pNextLayer = NULL;
	curtain_widget[0].pParallelNext = &curtain_widget[1];
	curtain_widget[0].parent = 0;
	curtain_widget[0].winLayer = 2;
	curtain_widget[0].transparency = 1;
	SetPictureHmem(&curtain_widget[0], 0, 0, GetPicturePathHmem(I_DTA_PATH_BGHOME));


	curtain_widget[1].guiTCB.winType = WIDGET_STATIC_TEXT;
	AddStringToBuffer(curtain_widget[1].guiTCB.winName, "窗帘");
	curtain_widget[1].guiTCB.xPos = 290;
	curtain_widget[1].guiTCB.yPos = 36;
	curtain_widget[1].guiTCB.xSize = 140;
	curtain_widget[1].guiTCB.ySize = 40;
	curtain_widget[1].appTCB.funType = SWITCH_ACTUATOR;
	curtain_widget[1].appTCB.addrList = 0;
	curtain_widget[1].guiTCB.id = GetUniqueID();
	curtain_widget[1].pPreviousLayer = NULL;
	curtain_widget[1].pNextLayer = NULL;
	curtain_widget[1].pParallelNext = &curtain_widget[2];
	curtain_widget[1].parent = NULL;



	curtain_widget[2].guiTCB.winType = WIDGET_BUTTON;
	curtain_widget[2].guiTCB.xPos = 0;
	curtain_widget[2].guiTCB.yPos = 20;
	curtain_widget[2].guiTCB.xSize = 120;
	curtain_widget[2].guiTCB.ySize = 120;
	curtain_widget[2].appTCB.funType = RETURN_FUNCTION;
	curtain_widget[2].appTCB.addrList = 0;
	curtain_widget[2].guiTCB.id = GetUniqueID();
	curtain_widget[2].pPreviousLayer = NULL;
	curtain_widget[2].pNextLayer = NULL;
	curtain_widget[2].pParallelNext = &curtain_widget[3];
	curtain_widget[2].parent = NULL;
	sprintf(curtain_widget[2].guiTCB.onPath, "%s", RETURN);
	sprintf(curtain_widget[2].guiTCB.offPath, "%s", RETURN);



	curtain_widget[3].guiTCB.winType = WIDGET_BUTTON;
	AddStringToBuffer(curtain_widget[3].guiTCB.winName, "合");
	curtain_widget[3].guiTCB.xPos = 50;
	curtain_widget[3].guiTCB.yPos = 320;
	curtain_widget[3].guiTCB.xSize = 120;
	curtain_widget[3].guiTCB.ySize = 200;
	curtain_widget[3].appTCB.funType = SWITCH_ACTUATOR;
	curtain_widget[3].appTCB.addrList = 0;
	curtain_widget[3].guiTCB.id = GetUniqueID();
	curtain_widget[3].pPreviousLayer = NULL;
	curtain_widget[3].pNextLayer = NULL;
	curtain_widget[3].pParallelNext = &curtain_widget[4];
	curtain_widget[3].parent = NULL;
	sprintf(curtain_widget[3].guiTCB.onPath, "%s", DTA_CURTAIN_CLOSE);
	sprintf(curtain_widget[3].guiTCB.offPath, "%s", DTA_CURTAIN_CLOSE);


	curtain_widget[4].guiTCB.winType = WIDGET_BUTTON;
	AddStringToBuffer(curtain_widget[4].guiTCB.winName, "暂停/启动");
	curtain_widget[4].guiTCB.xPos = 275;
	curtain_widget[4].guiTCB.yPos = 250;
	curtain_widget[4].guiTCB.xSize = 180;
	curtain_widget[4].guiTCB.ySize = 280;
	curtain_widget[4].appTCB.funType = SWITCH_ACTUATOR;
	curtain_widget[4].appTCB.addrList = 0;
	curtain_widget[4].guiTCB.id = GetUniqueID();
	curtain_widget[4].pPreviousLayer = NULL;
	curtain_widget[4].pNextLayer = NULL;
	curtain_widget[4].pParallelNext = &curtain_widget[5];
	curtain_widget[4].parent = NULL;
	sprintf(curtain_widget[4].guiTCB.onPath, "%s", DTA_CURTAIN_CONTINUE);
	sprintf(curtain_widget[4].guiTCB.offPath, "%s", DTA_CURTAIN_PAUSE);


	curtain_widget[5].guiTCB.winType = WIDGET_BUTTON;
	AddStringToBuffer(curtain_widget[5].guiTCB.winName, "开");
	curtain_widget[5].guiTCB.xPos = 550;
	curtain_widget[5].guiTCB.yPos = 320;
	curtain_widget[5].guiTCB.xSize = 120;
	curtain_widget[5].guiTCB.ySize = 200;
	curtain_widget[5].appTCB.funType = SWITCH_ACTUATOR;
	curtain_widget[5].appTCB.addrList = 0;
	curtain_widget[5].guiTCB.id = GetUniqueID();
	curtain_widget[5].pPreviousLayer = NULL;
	curtain_widget[5].pNextLayer = NULL;
	curtain_widget[5].pParallelNext = NULL;
	curtain_widget[5].parent = NULL;
	sprintf(curtain_widget[5].guiTCB.onPath, "%s", DTA_CURTAIN_OPEN);
	sprintf(curtain_widget[5].guiTCB.offPath, "%s", DTA_CURTAIN_OPEN);

	Concatenate(curtain_widget, 6, 2);
	CreateWidget(&curtain_widget[0], hParent, 0);

}